import { createApp } from 'vue'
import { MotionPlugin } from '@vueuse/motion'
import ElementPlus from 'element-plus'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import { useDark, useToggle } from '@vueuse/core'

import App from './App.vue'

// 导入样式
import 'element-plus/dist/index.css'
import './style.css'

// 初始化深色模式
const isDark = useDark()
const toggleDark = useToggle(isDark)

// 创建应用
const app = createApp(App)

// 注册 Element Plus 图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

// 使用插件
app.use(ElementPlus)
app.use(MotionPlugin)

// 挂载应用
app.mount('#app')